﻿project(subscriber)

string(REGEX REPLACE "(.*)/(.*)/(.*)" "\\1" PROJECT_CTK_DIR  ${PROJECT_SOURCE_DIR})
find_package(Qt5 REQUIRED COMPONENTS Widgets Core Gui REQUIRED)
add_definitions(-DHAVE_QT5)

set(PLUGIN_NAME cn.qtio.subscriber)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(BUILD_SHARED_LIBS ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_CTK_DIR}/bin/cmake/debug/plugins)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_CTK_DIR}/bin/cmake/release/plugins)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJECT_CTK_DIR}/bin/cmake/debug/plugins)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJECT_CTK_DIR}/bin/cmake/release/plugins)

FILE(GLOB HEADER_FILES "${PROJECT_CTK_DIR}/Plugins/${PLUGIN_NAME}/*.h" "${PROJECT_CTK_DIR}/Plugins/${PLUGIN_NAME}/*.hpp")
FILE(GLOB SOURCE_FILES "${PROJECT_CTK_DIR}/Plugins/${PLUGIN_NAME}/*.c" "${PROJECT_CTK_DIR}/Plugins/${PLUGIN_NAME}/*.cpp")
FILE(GLOB UI_FILES "${PROJECT_CTK_DIR}/Plugins/${PLUGIN_NAME}/*.ui")
file(GLOB_RECURSE QRC_SOURCE_FILES ${PROJECT_CTK_DIR}/Plugins/${PLUGIN_NAME}/*.qrc)
qt5_wrap_ui(WRAP_FILES ${UI_FILES})
qt5_add_resources(QRC_FILES ${QRC_SOURCE_FILES})

link_directories(debug ${PROJECT_CTK_DIR}/bin/cmake/debug
    optimized ${PROJECT_CTK_DIR}/bin/cmake/release)
include_directories(${PROJECT_CTK_DIR}/Libs/Core ${PROJECT_CTK_DIR}/Libs/PluginFramework)

add_library(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES} ${QRC_FILES} ${WRAP_FILES})
add_dependencies(${PROJECT_NAME} PluginFramework Core)
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Gui Qt5::Widgets libPluginFramework.dll.a libCore.dll.a)
